import 'package:opencv_dart/opencv_dart.dart' as cv;

class SendableRect {
  final int x, y, width, height;
  final List<double> rawDetection;
  final (int, int) rightEye;
  final (int, int) leftEye;
  final (int, int) nose;
  final (int, int) rcMouth;
  final (int, int) lcMouth;

  SendableRect({
    required this.x,
    required this.y,
    required this.width,
    required this.height,
    required this.rawDetection,
    required this.rightEye,
    required this.leftEye,
    required this.nose,
    required this.rcMouth,
    required this.lcMouth,
  });

  cv.Rect toRect() {
    return cv.Rect(x, y, width, height);
  }

  List<(int, int)> get facialFeatures =>
      [rightEye, leftEye, nose, rcMouth, lcMouth];

  Map<String, dynamic> toMap() {
    return {
      'x': x,
      'y': y,
      'width': width,
      'height': height,
      'rawDetection': rawDetection,
    };
  }

  String stringify() {
    return 'SendableRect(x: $x, y: $y, width: $width, height: $height, rightEye: $rightEye, leftEye: $leftEye, nose: $nose, rcMouth: $rcMouth, lcMouth: $lcMouth)';
  }
}
